<?php

namespace app\api\controller;

use app\api\model\CompanyOrderModel;
use app\api\model\GoodsOrderModel;
use app\api\model\HandlerModel;
use app\api\model\MemberModel;
use app\api\model\SourceModel;
use app\api\model\SpecialOrder;
use app\api\model\UserAddressModel;
use app\api\model\WithdrawalModel;

class User extends Api
{

    public function getUser()
    {
        $data = (new MemberModel())->getUser($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    public function updateUser(){
        $data = (new MemberModel())->updateUser($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    public function getSpecOrder(){
        $data = (new SpecialOrder())->getSpecOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getSpecOrderDetail(){
        $data = (new SpecialOrder())->getSpecOrderDetail($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function cancelSpecOrder(){
        $data = (new SpecialOrder())->cancelSpecOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getPackageOrder(){
        $data = (new CompanyOrderModel())->getPackageOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getPackageOrderDetail(){
        $data = (new CompanyOrderModel())->getPackageOrderDetail($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function cancelPackageOrder(){
        $data = (new CompanyOrderModel())->cancelPackageOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getGoodsOrder(){
        $data = (new GoodsOrderModel())->getGoodsOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getGoodsOrderDetail(){
        $data = (new GoodsOrderModel())->getGoodsOrderDetail($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    public function cancelGoodsOrder(){
        $data = (new GoodsOrderModel())->cancelGoodsOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function confirmGoodsOrder(){
        $data = (new GoodsOrderModel())->confirmGoodsOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function addAddress(){
        $data = (new UserAddressModel())->addAddress($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function updateAddress(){
        $data = (new UserAddressModel())->updateAddress($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function deleteAddress(){
        $data = (new UserAddressModel())->deleteAddress($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function getAddressList(){
        $data = (new UserAddressModel())->getAddressList($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    public function userRetailInfo(){
        $data = (new MemberModel())->userRetailInfo($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    public function userRetailList(){
        $data = (new MemberModel())->userRetailList($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }

    public function userRetailDetail(){
        $data = (new MemberModel())->userRetailDetail($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    //申请提现
    public function withdrawal(){
        $data = (new WithdrawalModel())->withdrawal($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }


    //申请提现
    public function userWithdrawal(){
        $data = (new WithdrawalModel())->userWithdrawal($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }
}